package com.example.schoolenterprisealliance.adapter;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.example.schoolenterprisealliance.R;
import com.example.schoolenterprisealliance.bean.Information;
import com.example.schoolenterprisealliance.bean.Policy;
import com.example.schoolenterprisealliance.html.HtmlText;
import com.example.schoolenterprisealliance.io.GetRoundBitmapByShader;
import com.example.schoolenterprisealliance.io.MyBitmap;
import com.example.schoolenterprisealliance.time.Time;

import java.io.IOException;
import java.util.List;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

public class PolicyAdapter extends BaseQuickAdapter <Policy.DataBean, BaseViewHolder>{

    public PolicyAdapter(int layoutResId, @Nullable List<Policy.DataBean> data) {
        super(layoutResId, data);
    }
    @Override
    protected void convert(@NonNull BaseViewHolder helper, Policy.DataBean item) {
        try {
            helper.setText(R.id.tv_context, HtmlText.Html.delHTMLTag(item.getContext()))
                    .setText(R.id.tv_time, item.getTime())
                    .setText(R.id.tv_title,item.getTitle())
                    .setImageBitmap(R.id.iv_img, GetRoundBitmapByShader.getRoundBitmapByShader
                            (MyBitmap.getBitmap(item.getImgUrl()),300,200,20,0));
        } catch (IOException e) {
            e.printStackTrace();
        }


    }
}